$(function () {
    $("#transferEditTime").blur(function () {
        checktime();
    })



    $("#check").click(function () {
        var transferDate = $("#transferDate").val();
        var transferEditTime = $("#transferEditTime").val();
        var transferBuyer = $("#transferBuyer").val();
        var transferVender = $("#transferVender").val();

        $.ajax({
            type:"post",
            url:"guohu_fenye.do",
            data:"transferDate="+transferDate+"&"+"transferEditTime="+transferEditTime+"&"+"transferBuyer="+transferBuyer+"&"+"transferVender="+transferVender,
            dataType:"json",
            success:function (data) {
                // alert(data)
                $("#table").html("");
                for (var i=0;i<data.list.length;i++)
                {
                    $("#table").append("<tr>" +
                        "<td width='17%'>"+data.list[i].transferId+"<td/>" +
                        "<td width='17%'>"+data.list[i].transferBuyer+"<td/>" +
                        "<td width='17%'>"+data.list[i].transferVender+"<td/>" +
                        "<td width='17%'>"+data.list[i].transferState+"<td/>" +
                        "<td width='17%'>"+data.list[i].transferDate+"<td/>" +
                        "<td width='17%'>"+data.list[i].transferEditTime+"<td/>" +
                        "</tr>")

                }

                // $.each(data.list,function (i,n) {
                //     $("#table").empty();
                //     $("#table").append("<tr>" +
                //         "<td>"+n.transferId+"<td/>" +
                //         "<td>"+n.custName+"<td/>" +
                //         "<td>"+n.custIcChip+"<td/>" +
                //         "<td>"+n.custTel+"<td/></tr>")
                // })
            }
        })
    })
})


//判断日期
function checktime() {
    var zdata = new Date(document.getElementById("transferDate").value.replace("//-/g", "//"));
    var wdata = new Date(document.getElementById("transferEditTime").value.replace("//-/g", "//"));
    if(wdata<zdata){
        alert("结算日期不能小于开始日期")
    }else {

    }

}